package com.etc.logManage.vo;

import java.sql.Timestamp;

import com.etc.common.enums.LoginTypeEnum;
import com.etc.common.enums.UserTypeEnum;
import com.etc.common.model.BaseModel;
import com.etc.common.util.DateUtils;
import com.etc.common.util.StringUtil;
import com.etc.logManage.model.LogLoginModel;
import com.etc.user.model.User;

/**
 * @Title: LogLoginVO.java
 * @Package com.etc.logManage.vo
 * @Description: TODO
 * @author 黄宇
 * @date 2016年3月27日 下午9:50:30
 * @version V1.0
 */
public class LogLoginVO extends BaseModel {

	private static final long serialVersionUID = -5099678564046685388L;

	// id
	private String tllId;

	// 登录用户账号
	private String tsuName;

	// 登录IP
	private String tllIp;

	// 登录类型
	private String tllType;

	// 登录时间
	private String tllTime;

	// 用户类型（app用户、网站用户、后台用户）
	private String tllUserType;
	
	public String getTllUserType() {
		return tllUserType;
	}

	public void setTllUserType(String tllUserType) {
		this.tllUserType = tllUserType;
	}

	public String getTsuName() {
		return tsuName;
	}

	public void setTsuName(String tsuName) {
		this.tsuName = tsuName;
	}

	public String getTllId() {
		return tllId;
	}

	public void setTllId(String tllId) {
		this.tllId = tllId;
	}

	public String getTllIp() {
		return tllIp;
	}

	public void setTllIp(String tllIp) {
		this.tllIp = tllIp;
	}

	public String getTllType() {
		return tllType;
	}

	public void setTllType(String tllType) {
		this.tllType = tllType;
	}

	public String getTllTime() {
		return tllTime;
	}

	public void setTllTime(String tllTime) {
		this.tllTime = tllTime;
	}
	
	public LogLoginModel vo2Model(){
		LogLoginModel model = new LogLoginModel();
		if(StringUtil.isNotEmpty(this.tllId)){
			model.setTllId(Integer.valueOf(this.tllId));
		}
		model.setTsuName(this.tsuName);
		model.setTllIp(this.tllIp);
		model.setTllTime(DateUtils.getTimestampFromDateStr(this.tllTime));
		if(StringUtil.isNotEmpty(this.tllType)){
			model.setTllType(LoginTypeEnum.getValueByName(this.tllType));
		}
		if(StringUtil.isNotEmpty(this.tllUserType)){
			model.setTllUserType(UserTypeEnum.getValueByName(this.tllUserType));
		}
		return model;
	}
	
}
